import multiprocessing

class MyProcess(multiprocessing.Process):
    def run(self):
        print(f"{self._args[0]}执行进程：", type(self._args))


"""
if __name__ == '__main__':
    multiprocessing.set_start_method("spawn")
    p = MyProcess(args='xxx',)
    p.start()
    print(multiprocessing.cpu_count())
    print("继续执行。。。。")
    """


"""
建议 cpu有多少个数，就多个进程；不超过它
"""
if __name__ == '__main__':
    multiprocessing.set_start_method("spawn")
    count = multiprocessing.cpu_count()
    for i in range(count-1):   # 排除当前主进程
        p = MyProcess(args=(f'xxx{i}',))
        p.start()
